package com.cpj.bsyyzx.controller;


import com.cpj.bsyyzx.entity.RolePermission;
import com.cpj.bsyyzx.service.IRolePermissionService;
import com.cpj.bsyyzx.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-05-09
 */
@RestController
@RequestMapping("/rolePermission")
public class RolePermissionController {
    @Autowired
    IRolePermissionService rolePermissionService;
    @RequestMapping("/get-permiss")
    CommonResult getPermiss() {
        return CommonResult.success(rolePermissionService.getPermission());
    }

    @RequestMapping("/save")
    CommonResult save(RolePermission RolePermission) {
        return CommonResult.success(rolePermissionService.saveOrUpdate(RolePermission));
    }


    @RequestMapping("/getByRoleId")
    CommonResult getByRoleId(Integer roleId) {
        return CommonResult.success(rolePermissionService.getByRoleId(roleId));
    }
}
